﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace SYH.News.BLL
{
    public class PublicNews
    {
        private static readonly SYH.News.DAL.PublicNews dal = new DAL.PublicNews();

        #region 用户发布新闻数量
        /// <summary>
        /// 得到用户发布新闻数量
        /// </summary>
        /// <param name="userid">用户Id</param>
        /// <returns></returns>
        public static int GetCountNews(int userid)
        {

            return dal.GetCountNews(userid);

        }

        #endregion

        #region 新闻实体
        /// <summary>
        /// 新闻实体
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        public static SYH.News.Model.PublicNews GetModel(int Id)
        {

            return dal.GetModel(Id);
        }
        #endregion

        #region 新闻添加
        /// <summary>
        /// 新闻添加
        /// </summary>
        /// <param name="model"></param>
        /// <returns>受影响行数</returns>
        public static int NewsAdd(SYH.News.Model.PublicNews model)
        {
            return dal.NewsAdd(model);
        }
        #endregion

        #region 新闻修改
        /// <summary>
        /// 新闻修改
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static int NewsUpdate(SYH.News.Model.PublicNews model)
        {

            return dal.NewsUpdate(model);
        }
        #endregion

        #region 新闻删除
        /// <summary>
        /// 新闻删除
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="idList"></param>
        /// <returns></returns>
        public static int NewsDelete(int userId, string idList)
        {
             return dal.NewsDelete( userId,  idList);
        }
        #endregion

        #region 新闻设置置顶
        /// <summary>
        /// 新闻设置置顶
        /// </summary>
        /// <param name="userId">用户编号</param>
        /// <param name="newId">新闻编号</param>
        /// <param name="isTop">1：置顶  0：取消</param>
        /// <returns></returns>
        public static int NewsSetTop(int userId, int newId, int isTop)
        {
           return dal.NewsSetTop( userId,  newId,  isTop);
        }
        #endregion

        #region  新闻分页数据
        /// <summary>
        /// 新闻分页数据
        /// </summary>
        /// <param name="pageSize"></param>
        /// <param name="pageIndex"></param>
        /// <param name="userId"></param>
        /// <param name="status">状态</param>
        /// <param name="pageCount"></param>
        /// <param name="recordCount"></param>
        /// <returns></returns>
        public static DataTable GetPageData(int pageSize, int pageIndex, int userId, int status, out int pageCount, out int recordCount)
        {
            

            return dal.GetPageData( pageSize,  pageIndex,  userId,  status, out  pageCount, out  recordCount);
        }
        #endregion

        #region 新闻状态数
        /// <summary>
        /// 新闻状态数
        /// </summary>
        /// <param name="status"></param>
        /// <param name="userId"></param>
        /// <returns></returns>
        public static int StatusCount(int status, int userId)
        {
            return dal.StatusCount(status,  userId);
        }
        #endregion

    }
}
